use args::Cli;
use clap::Parser;

mod args;
mod chunk;
mod chunk_type;
mod commands;
mod crc;
mod png;
pub type Error = Box<dyn std::error::Error>;
pub type Result<T> = std::result::Result<T, Error>;

fn main() {
    let cli = Cli::parse();

    match &cli.command {
        args::Commands::Decode { file, chunk_type } => {
            commands::Commands::decode(file.clone(), chunk_type.clone())
        }
        args::Commands::Encode {
            file,
            chunk_type,
            message,
        } => {
            commands::Commands::encode(file.clone(), chunk_type.clone(), message.clone());
        }
        args::Commands::Remove { file, chunk_type } => {
            commands::Commands::remove(file.clone(), chunk_type.clone());
        }
        args::Commands::Print { file } => {
            commands::Commands::print(file.clone());
        }
    }
}
